﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TPAMain数据维护工具V2
{
    public partial class frmGDEditor : Form
    {
        SqlTools sqt;

        /// <summary>
        /// 初始查询语句
        /// </summary>
        string strDefaultSelectString = "select gd002 开卡日期,gd001 工单号,gd007 型号规格,gd008 产品名称,gd010 开卡数量,gd034 批号,gd025 工单类型,gd039 工单性质,gd040 工单生成来源,gd026 来源工单,gd030 执行标准,gd031 质量等级,gd036 备注,gd020 已审核 from gd_table";

        /// <summary>
        /// 临时变量，用于存储ContextMenu上级DataGridView
        /// </summary>
        DataGridView tmpdgv;

        #region tp1查询语句
        string tp1_strSelectGDInfo = "select gd002 开卡日期,gd007 型号规格,gd008 产品名称,gd034 批号,gd010 开卡数量,gd030 执行标准,gd031 质量等级,gd036 备注 from gd_table where gd001='@GDNo'";
        #region 修改型号规格和产品名称
        //更新工单型号规格
        string tp1_strUpdateModelGd = "update gd_table set gd007='@型号规格',gd008='@产品名称' where gd001='@GDNo'";
        //更新工序结余型号规格
        string tp1_strUpdateModelGxjy = "update gxjy_table set gxjy004='@型号规格',gxjy005='@产品名称' where gxjy001='@GDNo'";
        //更新工序移转型号规格
        string tp1_strUpdateModelGxyz = "update gxyz_table set gxyz004='@型号规格',gxyz005='@产品名称' where gxyz001='@GDNo'";
        //更新工序入库型号规格
        string tp1_strUpdateModelGxrk = "update gxrk_table set rk013='@型号规格',rk014='@产品名称' where rk031='@GDNo'";
        //更新检验接收单型号规格
        string tp1_strUpdateModelJyjs = "update jyjs_table set jyjs016='@型号规格',jyjs017='@产品名称' where jyjs008='@GDNo'";
        //更新批量检验单型号规格
        string tp1_strUpdateModelPljy = "update qca_table set qca015='@型号规格' where qca011='@GDNo'";
        #endregion
        #region 修改开卡日期
        string tp1_strUpdateKkrq = "update gd_table set gd002='@开卡日期' where gd001='@GDNo'";
        #endregion
        #region 修改批号
        //更新工单生产批号
        string tp1_strUpdateSNGd = "update gd_table set gd034='@SN' where gd001='@GDNo'";
        //更新工序结余生产批号
        string tp1_strUpdateSNGxjy = "update gxjy_table set gxjy016='@SN' where gxjy001='@GDNo'";
        //更新移转单生产批号
        string tp1_strUpdateSNGxyz = "update gxyz_table set gxyz027='@SN' where gxyz001='@GDNo'";
        //更新入库生产批号
        string tp1_strUpdateSNGxrk = "update gxrk_table set rk008='@SN' where rk031='@GDNo'";
        //更新出库生产批号
        string tp1_strUpdateSNGxck = "update gxck_table set gxck017='@SN' where gxck007='@GDNo'";
        //更新检验接收单生产批号
        string tp1_strUpdateSNJyjs = "update jyjs_table set jyjs009='@SN' where jyjs008='@GDNo'";
        //更新批量检验单生产批号
        string tp1_strUpdateSNPljy = "update qca_table set qca012='@SN' where qca011='@GDNo'";
        #endregion
        #region 修改开卡数量
        //更新开卡数量
        string tp1_strUpdateKKSL = "update gd_table set gd010=@开卡数量 where gd001='@GDNo'";
        #endregion
        #region 修改工单备注
        string tp1_strUpdateMemo = "update gd_table set gd036='@备注' where gd001='@GDNo'";
        #endregion
        #region 修改执行标准
        string tp1_strUpdateZxbz = "update gd_table set gd030='@执行标准' where gd001='@GDNo'";
        #endregion
        #region 修改质量等级
        string tp1_strUpdateZldj = "update gd_table set gd031='@质量等级' where gd001='@GDNo'";
        #endregion
        #endregion
        #region tp2查询语句
        string tp2_strSelectGdgx = "select gdgx003 工序名称 from gdgx_table where gdgx001='@GDNo' order by gdgx002"; 
        //删除工序设置
        string tp2_strDeleteGdgx = "delete from gdgx_table where gdgx001='@GDNo'";
        //添加工单工序
        string tp2_strInsertGdgx = "insert into gdgx_table (gdgx001,gdgx002,gdgx003,gdgx004) values ('@GDNo',@序号,'@工序名称','@工单类型')";
        #endregion
        #region tp3查询语句
        string tp3_strSelectGxjy = "select gxjy000 序号,gxjy007 工序名称,gxjy008 原结余数量,gxjy008 新结余数量,gxjy011 原货架号,gxjy011 新货架号,gxjy012 原生产日期,gxjy012 新生产日期,gxjy013 原淘汰率,gxjy013 新淘汰率,gxjy014 原筛选数量,gxjy014 新筛选数量,gxjy015 原备注,gxjy015 新备注,gxjy016 原批号,gxjy016 新批号 from gxjy_table where gxjy001='@GDNo' order by gxjy000";
        //更新指定序号工序结余的值
        string tp3_strUpdateGxjy = "update gxjy_table set @字段='@值' where gxjy000=@序号";
        #endregion
        #region tp4查询语句
        string tp4_strSelectGxyz_Quantity = "select gxyz000 序号,gxyz011 移转单号,gxyz007 转出工序,gxyz008 转入工序,gxyz009 原合格数量,gxyz009 新合格数量,gxyz010 原报废数量,gxyz010 新报废数量,gxyz022 原接收确认数量,gxyz022 新接收确认数量,gxyz030 原转出数量,gxyz030 新转出数量,gxyz033 原扣上工序数量,gxyz033 新扣上工序数量 from gxyz_table where gxyz001='@GDNo' order by gxyz000";
        string tp4_strSelectGxyz_OtherInfo = "select gxyz000 序号,gxyz011 移转单号,gxyz012 原移转日期,gxyz012 新移转日期,gxyz007 原转出工序,gxyz007 新转出工序,gxyz008 原转入工序,gxyz008 新转入工序,gxyz025 原接收确认人,gxyz025 新接收确认人,gxyz026 原接收确认时间,gxyz026 新接收确认时间,gxyz029 原备注,gxyz029 新备注,gxyz023 已检验,gxyz034 检验结论,gxyz035 移转状态 from gxyz_table where gxyz001='@GDNo' order by gxyz000";
        //更新指定序号工序移转的值
        string tp4_strUpdateGxyz = "update gxyz_table set @字段='@值' where gxyz000=@序号";
        //按日期查询最大移转单号
        string tp4_strSelectMaxGxyzID = "select max(gxyz011) 最大移转单号 from gxyz_table where gxyz011 like '@Date%'";
        #endregion
        #region tp6查询语句
        string tp6_strSelectGxrk = "select rk001 入库单号,rk002 入库日期,rk013 型号规格,rk018 入库数量,rk033 实际入库数量,rk027 货架号,rk028 生产日期,rk029 淘汰率,rk030 筛选数量,rk036 产品厚度,rk019 备注,rk008 生产批号,rk003 操作人,rk007 移转单号 from gxrk_table where rk031='@GDNo' and rk020='Y'";
        //更新指定入库单号入库单的值
        string tp6_strUpdateGxrk = "update gxrk_table set @字段='@值' where rk001='@入库单号'";
        //按入库单号刷新工序结余信息中的货架号、生产日期、淘汰率、筛选数量、备注
        string tp6_strUpdateGxjyFromGxrk = "update gxjy_table set gxjy011=rk027,gxjy012=rk028,gxjy013=rk029,gxjy014=rk030,gxjy015=rk019,gxjy024=rk036 from gxrk_table where gxjy001=rk031 and gxjy007=rk017 and rk001='@入库单号'";
        //按入库单号刷新出库单信息中的货架号、生产日期、淘汰率、筛选数量
        string tp6_strUpdateGxckFromGxrk = "update gxck_table set gxck020=rk027,gxck021=rk028,gxck022=rk029,gxck023=rk030,gxck055=rk036 from gxrk_table where gxck007=rk031 and rk001='@入库单号'";
        #endregion
        #region tp7查询语句
        string tp7_strSelectGxck = "select gxck001 出库单号,gxck012 型号规格,gxck013 产品名称,gxck015 出库数量,gxck037 试验数量,gxck016 单据状态,gxck017 流转卡号,gxck019 出库退回数量,gxck020 货架号,gxck021 生产日期,gxck022 淘汰率,gxck023 筛选数量,gxck055 产品厚度,gxck024 备注,gxck026 出库类别,gxck028 新工单号,gxck039 自检出库卡号,hta011 合同号 from gxck_table left join hta_table on hta001=gxck010 where gxck007 ='@GDNo' and (gxck016='C' or gxck016='Y' or gxck016='K') order by gxck001";
        //更新指定出库单号出库单的值
        string tp7_strUpdateGxck = "update gxck_table set @字段='@值' where gxck001='@出库单号'";
        #endregion
        #region tp8查询语句
        string tp8_strSelectSubGD = "select gd001 工单号,gd007 型号规格,gd010 开卡数量,gd034 批号,gd025 工单类型,gd039 工单性质,gd040 工单生成来源,gd036 工单备注,gd020 已审核 from gd_table where gd026='@GDNo' order by gd001";
        //根据指定工单号查询批号
        string tp8_strSelectSNFromGdno = "select gd034 from gd_table where gd001='@GDNo'";
        //按批号查芯片库存
        string tp8_strSelectKcFromSN = "select gxjy001 工单号,gxjy004 型号规格,gxjy007 工序,gxjy008 结余数量,gxjy016 生产批号 from gxjy_table where gxjy016 like'@批号' and gxjy007='@工序名称'";
        //按工单号查芯片库存
        string tp8_strSelectKcFromGdno = "select gxjy008 结余数量 from gxjy_table where gxjy001 = '@GDNo' and gxjy007='@工序名称'";
        //按工单号和工序更新工序结余
        string tp8_strUpdateGxjy = "update gxjy_table set @字段=@值 where gxjy001='@GDNo' and gxjy007='@工序名称'";
        //更新来源工单
        string tp8_strUpdateResourceGD = "update gd_table set gd026='@来源工单' where gd001='@GDNo'";
        #endregion
        #region tp9查询语句
        string tp9_strSelectPraka = "SELECT aka002 型号,aka003 尺寸,aka004 特性,aka005 电压,aka006 容量,aka007 精度,aka008 印叠机型,aka009 排粘曲线,aka010 烧结温度,aka011 瓷膜批号,aka012 内浆批号,aka013 端浆批号,aka014 丝网代号,aka015 印叠层数,aka016 瓷料名称,aka017 钵号,aka018 质量等级,aka019 膜厚,aka020 芯片尺寸 FROM praka_table where aka001='@GDNo'"; 
        //更新指定工单号的工程设计参数
        string tp9_strUpdatePraka = "update praka_table set @字段='@值' where aka001='@GDNo'";
        #endregion
        #region tp10查询语句
        //查询记录条数
        string tp10_strSelectKksl = "select gd010 开卡数量 from gd_table where gd001='@GDNo'";
        string tp10_strSelectKkgx = "select top 1 gxjy007 开卡工序 from gxjy_table where gxjy001='@GDNo' order by gxjy000";
        string tp10_strSelectGd = "select count(*) from gd_table where gd001='@GDNo'";
        string tp10_strSelectGdgx = "select count(*) from gdgx_table where gdgx001='@GDNo'";
        string tp10_strSelectCfd = "select count(*) from cgd_table where gd026='@GDNo'";
        string tp10_strSelectGxjy = "select count(*) from gxjy_table where gxjy001='@GDNo'";
        string tp10_strSelectGxyz = "select count(*) from gxyz_table where gxyz001='@GDNo'";
        string tp10_strSelectJyjs = "select count(*) from jyjs_table where jyjs008='@GDNo'";
        string tp10_strSelectPljy = "select (select count(*) from qca_table where qca011='@GDNo')+(select count(*) from qcb_table,qca_table where qca001=qcb001 and qca011='@GDNo')";
        string tp10_strSelectGxrk = "select count(*) from gxrk_table where rk031='@GDNo'";
        string tp10_strSelectGxck = "select count(*) from gxck_table where gxck007='@GDNo'";
        string tp10_strSelectJywh = "select count(*) from jywh_table where jy007='@GDNo'";
        string tp10_strSelectSubGd = "select count(*) from gd_table where gd026='@GDNo'";
        string tp10_strSelectJsqr = "select count(*) from ckjsqr_table where jsqr008='@GDNo'";
        //删除记录
        string tp10_strDeleteGdgx = "Delete  from gdgx_table where gdgx001='@GDNo'";
        string tp10_strDeleteCfd = "Delete  from cgd_table where gd026='@GDNo'";
        string tp10_strDeleteGxjy = "Delete  from gxjy_table where gxjy001='@GDNo' and gxjy007<>'@开卡工序'";
        string tp10_strDeleteGxyz = "Delete  from gxyz_table where gxyz001='@GDNo'";
        string tp10_strDeleteJyjs = "Delete  from jyjs_table where jyjs008='@GDNo'";
        string tp10_strDeleteQca = "Delete  from qca_table where qca011='@GDNo'";
        string tp10_strDeleteQcb = "Delete  from qcb_table where exists (select qca001 from qca_table where qca001=qcb001 and qca011='@GDNo')";
        string tp10_strDeleteGxrk = "Delete  from gxrk_table where rk031='@GDNo'";
        string tp10_strDeleteGxck = "Delete  from gxck_table where gxck007='@GDNo'";
        string tp10_strDeleteJywh = "Delete  from jywh_table where jy007='@GDNo'";
        //更新结余
        string tp10_strUpdateGxjy = "update gxjy_table set gxjy008=gxjy008+@开卡数量 where gxjy001='@GDNo' and gxjy007='@开卡工序'";
        #endregion
        #region GxjyChanged
        //成品库出库数量、试验数量、入库数量发生变化时，更新结余数量
        string strUpdateGxjyChanged = "update gxjy_table set gxjy008=isnull((select SUM(rk033) from gxrk_table where rk031='@GDNo'),0)-ISNULL((select sum(zhb011) from prdjzha_table,prdjzhb_table where zha001=zhb001 and zha007='Y' and zhb003='@GDNo'),0)-isnull((select SUM(gxck015)-SUM(gxck019)+SUM(gxck037)+isnull((select SUM(hbb006) from jyhba_table,jyhbb_table where hba020='Y' and hba001=hbb001 and hbb003='@GDNo'),0) from gxck_table where gxck007='@GDNo' and (gxck016='Y' or gxck016='K' or gxck016='C')),0) where gxjy001='@GDNo' and gxjy007='成品库'";
        #endregion

        public frmGDEditor()
        {
            InitializeComponent();
        }

        private void frmGDEditor_Load(object sender, EventArgs e)
        {
            sqt = new SqlTools(GeneralTools.GetConnectionString(Properties.Settings.Default.Host, Properties.Settings.Default.DBName));
        }

        private void btnQuery_Click(object sender, EventArgs e)
        {
            Query(4);
        }

        private void txtSN_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                txtSN.Text = txtSN.Text.ToUpper().Trim();
                Query(1);
            }
        }

        private void txtGDNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                txtGDNo.Text = txtGDNo.Text.ToUpper().Trim();
                Query(2);
            }
        }

        private void txtModel_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                txtModel.Text = txtModel.Text.ToUpper().Trim();
                Query(3);
            }
        }

        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            tmpdgv = (DataGridView)((System.Windows.Forms.ContextMenuStrip)(sender)).SourceControl;
        }

        private void tsmiCopy_Click(object sender, EventArgs e)
        {
            if (tmpdgv.CurrentCell != null)
            {
                Clipboard.SetText(GeneralTools.GetString(tmpdgv.CurrentCell.Value, string.Empty));
            }
        }

        private void txtSN_Leave(object sender, EventArgs e)
        {
            txtSN.Text = txtSN.Text.Trim().ToUpper();
        }

        private void dgv1_CurrentCellChanged(object sender, EventArgs e)
        {
            if (dgv1 .CurrentRow ==null )
            {
                Clear();
                return ;
            }
            tabControl1_SelectedIndexChanged(this, new EventArgs());
        }

        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (dgv1 .CurrentRow ==null )
            {
                Clear();
                return ;
            }
            string strGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
            if (strGDNo.Equals(string.Empty))
            {
                Clear();
                return;
            }
            switch (tabControl1.SelectedIndex)
            {
                case 0:
                    iniTP1(strGDNo);
                    break;
                case 1:
                    iniTP2(strGDNo, GeneralTools.GetString(dgv1.CurrentRow.Cells["工单类型"].Value, string.Empty));
                    break;
                case 2:
                    iniTP3(strGDNo);
                    break;
                case 3:
                    iniTP4(strGDNo);
                    break;
                case 4:
                    break;
                case 5:
                    iniTP6(strGDNo);
                    break;
                case 6:
                    iniTP7(strGDNo);
                    break;
                case 7:
                    iniTP8(strGDNo, GeneralTools.GetString(dgv1.CurrentRow.Cells["工单类型"].Value, string.Empty));
                    break;
                case 8:
                    iniTP9(strGDNo);
                    break;
                case 9:
                    iniTP10(strGDNo);
                    break;
            }
        }

        private void tabControl2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl2.SelectedIndex == 1&&tp4_dgv2.Rows.Count >0)
            {
                for (int i = 0; i < tp4_dgv2.Rows.Count; i++)
                {
                    if ((!tp4_dgv2.Rows[i].Cells["已检验"].Value.Equals("Y")) ||
                        (!tp4_dgv2.Rows[i].Cells["检验结论"].Value.Equals("合格")))
                    {
                        //检验未合格的移转单为灰色
                        tp4_dgv2.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
                    }
                }
            }
        }

        private void dgv1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgv1.CurrentRow != null)
            {
                Clipboard.SetText(GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty));
                tsslResult.Text = "工单号" + GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty) + "已复制到剪贴板！";
            }
        }

        private void tp1_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1 .CurrentRow !=null &&(!GeneralTools .GetString (dgv1 .CurrentRow .Cells ["工单号"].Value ,string.Empty ).Equals (string.Empty )))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                #region 修改型号规格和产品名称
                if (!tp1_txtModelNew .Text .Equals (tp1_txtModelOld .Text ))
                {
                    string strTmpModelOld = tp1_txtModelOld.Text.Trim();
                    string strTmpProductNameOld = tp1_txtProductNameOld.Text.Trim();
                    string strTmpModelNew=tp1_txtModelNew .Text .Trim ();
                    string strTmpProductNameNew=tp1_txtProductNameNew .Text .Trim ();
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelGd.Replace("@型号规格", strTmpModelNew)
                                                                                                        .Replace("@产品名称", strTmpProductNameNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelGxjy .Replace("@型号规格", strTmpModelNew)
                                                                                                        .Replace("@产品名称", strTmpProductNameNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelGxyz .Replace("@型号规格", strTmpModelNew)
                                                                                                        .Replace("@产品名称", strTmpProductNameNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelGxrk .Replace("@型号规格", strTmpModelNew)
                                                                                                        .Replace("@产品名称", strTmpProductNameNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelJyjs .Replace("@型号规格", strTmpModelNew)
                                                                                                        .Replace("@产品名称", strTmpProductNameNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateModelPljy .Replace("@型号规格", strTmpModelNew)
                                                                                                           .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper .WriteLog ("工单号" + strTmpGDNo + "的型号规格由"+strTmpModelOld +"修改为"+strTmpModelNew +"；产品名称由"+strTmpProductNameOld +"修改为"+strTmpProductNameNew );
                    dgv1.CurrentRow.Cells["型号规格"].Value = tp1_txtModelNew.Text.Trim();
                    dgv1.CurrentRow.Cells["产品名称"].Value = tp1_txtProductNameNew.Text.Trim();
                }
                #endregion
                #region 修改开卡日期
                if (!tp1_txtKkrqNew.Text.Equals(tp1_txtKkrqOld.Text))
                {
                    string strTmpKkrqOld = tp1_txtKkrqOld.Text.Trim();
                    string strTmpKkrqNew = tp1_txtKkrqNew.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateKkrq .Replace("@开卡日期", strTmpKkrqNew)
                                                                                                     .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的开卡日期由" + strTmpKkrqOld + "修改为" + strTmpKkrqNew);
                    dgv1.CurrentRow.Cells["开卡日期"].Value = strTmpKkrqNew;
                }
                #endregion
                #region 修改批号
                if (!tp1_txtSNNew.Text.Equals(tp1_txtSNOld.Text))
                {
                    string strTmpSNOld = tp1_txtSNOld.Text.Trim();
                    string strTmpSNNew = tp1_txtSNNew.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNGd.Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNGxjy .Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNGxyz.Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNJyjs  .Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNPljy .Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNGxrk .Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateSNGxck .Replace("@SN", strTmpSNNew)
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的批号由" + strTmpSNOld  + "修改为" + strTmpSNNew);
                    dgv1.CurrentRow.Cells["批号"].Value = tp1_txtSNNew.Text.Trim();
                }
                #endregion
                #region 修改开卡数量
                if (!tp1_txtQuantityNew .Text.Equals(tp1_txtQuantityOld.Text))
                {
                    string strTmpQuantityOld = tp1_txtQuantityOld.Text.Trim();
                    string strTmpQuantityNew = tp1_txtQuantityNew.Text.Trim();
                    sqt .DoCmdExecuteNonQuery (tp1_strUpdateKKSL .Replace ("@开卡数量",strTmpQuantityNew )
                                                                                                .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的开卡数量由" + strTmpQuantityOld  + "修改为" + strTmpQuantityNew);
                    dgv1.CurrentRow.Cells["开卡数量"].Value = tp1_txtQuantityNew.Text.Trim();
                }
                #endregion
                #region 修改工单备注
                if (!tp1_txtMemoNew .Text.Equals(tp1_txtMemoOld.Text))
                {
                    string strTmpMemoOld = tp1_txtMemoOld.Text.Trim();
                    string strTmpMemoNew = tp1_txtMemoNew.Text.Trim();
                    sqt .DoCmdExecuteNonQuery (tp1_strUpdateMemo .Replace ("@备注",strTmpMemoNew )
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的备注由" + strTmpMemoOld  + "修改为" + strTmpMemoNew);
                    dgv1.CurrentRow.Cells["备注"].Value = tp1_txtMemoNew.Text.Trim();
                }
                #endregion
                #region 修改执行标准
                if (!tp1_txtZxbzNew.Text.Equals(tp1_txtZxbzOld.Text))
                {
                    string strTmpZxbzOld = tp1_txtZxbzOld.Text.Trim();
                    string strTmpZxbzNew = tp1_txtZxbzNew.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateZxbz.Replace("@执行标准", strTmpZxbzNew)
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的执行标准由" + strTmpZxbzOld + "修改为" + strTmpZxbzNew);
                    dgv1.CurrentRow.Cells["执行标准"].Value = tp1_txtZxbzNew.Text.Trim();
                }
                #endregion
                #region 修改质量等级
                if (!tp1_txtZldjNew.Text.Equals(tp1_txtZldjOld.Text))
                {
                    string strTmpZldjOld = tp1_txtZldjOld.Text.Trim();
                    string strTmpZldjNew = tp1_txtZldjNew.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp1_strUpdateZldj.Replace("@质量等级", strTmpZldjNew)
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的质量等级由" + strTmpZldjOld + "修改为" + strTmpZldjNew);
                    dgv1.CurrentRow.Cells["质量等级"].Value = tp1_txtZldjNew.Text.Trim();
                }
                #endregion
                tsslResult.Text = "修改工单号" + strTmpGDNo + "的工单信息完成！";
            }
        }

        private void tp2_btnA_Click(object sender, EventArgs e)
        {
            //清除原有数据
            tp2_lstGXNew.Items.Clear();
            //添加工序
            tp2_lstGXNew.Items.AddRange(new object[] { "发料", "印叠", "切块", "生胚倒角", "排粘", "烧结", "熟胚倒角", "A卡无损", "涂端", "烧银", "电镀", "半成品测量" });
        }

        private void tp2_btnB_ps_Click(object sender, EventArgs e)
        {
            //清除原有数据
            tp2_lstGXNew.Items.Clear();
            //添加工序
            tp2_lstGXNew.Items.AddRange(new object[] { "B卡发料","无损检测", "筛前外观", "筛选", "成品测量" });
        }

        private void tp2_btnByx_Click(object sender, EventArgs e)
        {
            //清除原有数据
            tp2_lstGXNew.Items.Clear();
            //添加工序
            tp2_lstGXNew.Items.AddRange(new object[] { "B卡发料", "无损检测", "焊接", "包封", "筛前成品测量", "筛选", "成品测量" });
        }

        private void tp2_btnC_Click(object sender, EventArgs e)
        {
            //清除原有数据
            tp2_lstGXNew.Items.Clear();
            //添加工序
            tp2_lstGXNew.Items.AddRange(new object[] { "C卡发料" });
        }

        private void tp2_btnModify_Click(object sender, EventArgs e)
        {
            if (tp2_lstGXNew.Items.Count == 0)
            {
                return;
            }
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo=GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                string strGDType = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单类型"].Value, string.Empty);
                switch (strGDType)
                {
                    case "A":
                        strGDType = "A卡";
                        break;
                    case "B":
                        strGDType = "B卡";
                        break;
                    case "C":
                        strGDType = "C卡";
                        break;
                    default :
                        strGDType = string.Empty;
                        break;
                }
                //删除原工单工序
                sqt.DoCmdExecuteNonQuery(tp2_strDeleteGdgx.Replace("@GDNo", strTmpGDNo));
                //逐条添加新工单工序
                for (int i = 1; i <= tp2_lstGXNew.Items.Count; i++)
                {
                    sqt.DoCmdExecuteNonQuery(tp2_strInsertGdgx.Replace("@GDNo", strTmpGDNo)
                                                                                                .Replace("@序号", i.ToString())
                                                                                                .Replace("@工序名称", tp2_lstGXNew.Items[i - 1].ToString())
                                                                                                .Replace("@工单类型", strGDType));
                }
                SQLLogHelper.WriteLog("工单号" + strTmpGDNo + "的工单工序修改为"+strGDType +"工序");
                tsslResult.Text = "修改工单号" + strTmpGDNo + "的工单工序完成！";
            }
        }

        private void tp3_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1 .CurrentRow !=null &&(!GeneralTools .GetString (dgv1 .CurrentRow .Cells ["工单号"].Value ,string.Empty ).Equals (string.Empty )))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp3_dgv1.Rows.Count > 0)
                {
                    tp3_dgv1.EndEdit();
                    for (int i = 0; i < tp3_dgv1.Rows.Count; i++)
                    {
                        string strTmpID = GeneralTools.GetString(tp3_dgv1.Rows[i].Cells["序号"].Value, string.Empty);
                        object objOriginalValue;
                        object objNewValue;
                        //结余数量
                        if (!tp3_dgv1.Rows[i].Cells["原结余数量"].Value.Equals(tp3_dgv1.Rows[i].Cells["新结余数量"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原结余数量"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新结余数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy008")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的结余数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //货架号
                        if (!tp3_dgv1.Rows[i].Cells["原货架号"].Value.Equals(tp3_dgv1.Rows[i].Cells["新货架号"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原货架号"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新货架号"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy011")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的货架号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //生产日期
                        if (!tp3_dgv1.Rows[i].Cells["原生产日期"].Value.Equals(tp3_dgv1.Rows[i].Cells["新生产日期"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原生产日期"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新生产日期"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy012")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的生产日期由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //淘汰率
                        if (!tp3_dgv1.Rows[i].Cells["原淘汰率"].Value.Equals(tp3_dgv1.Rows[i].Cells["新淘汰率"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原淘汰率"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新淘汰率"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy013")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的淘汰率由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //筛选数量
                        if (!tp3_dgv1.Rows[i].Cells["原筛选数量"].Value.Equals(tp3_dgv1.Rows[i].Cells["新筛选数量"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原筛选数量"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新筛选数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy014")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的筛选数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //备注
                        if (!tp3_dgv1.Rows[i].Cells["原备注"].Value.Equals(tp3_dgv1.Rows[i].Cells["新备注"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原备注"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新备注"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy015")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的备注由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //批号
                        if (!tp3_dgv1.Rows[i].Cells["原批号"].Value.Equals(tp3_dgv1.Rows[i].Cells["新批号"].Value))
                        {
                            objOriginalValue = tp3_dgv1.Rows[i].Cells["原批号"].Value;
                            objNewValue = tp3_dgv1.Rows[i].Cells["新批号"].Value;
                            sqt.DoCmdExecuteNonQuery(tp3_strUpdateGxjy.Replace("@字段", "gxjy016")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序结余序号" + strTmpID + "的批号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                    }
                    tsslResult.Text = "修改工单号" + strTmpGDNo + "的工序结余完成！";
                }
            }
        }

        private void tp3_btnCheckCPJy_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                sqt.DoCmdExecuteNonQuery(strUpdateGxjyChanged.Replace("@GDNo", strTmpGDNo));
                tsslResult.Text = "工单号" + strTmpGDNo + "的成品库工序结余校验完成！";
            }
        }

        private void tp4_btnModify1_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp4_dgv1.Rows.Count > 0)
                {
                    tp4_dgv1.EndEdit();
                    for (int i = 0; i < tp4_dgv1.Rows.Count; i++)
                    {
                        string strTmpID = GeneralTools.GetString(tp4_dgv1.Rows[i].Cells["序号"].Value, string.Empty);
                        object objOriginalValue;
                        object objNewValue;
                        //合格数量
                        if (!tp4_dgv1.Rows[i].Cells["原合格数量"].Value.Equals(tp4_dgv1.Rows[i].Cells["新合格数量"].Value))
                        {
                            objOriginalValue = tp4_dgv1.Rows[i].Cells["原合格数量"].Value;
                            objNewValue = tp4_dgv1.Rows[i].Cells["新合格数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz009")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的合格数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //报废数量
                        if (!tp4_dgv1.Rows[i].Cells["原报废数量"].Value.Equals(tp4_dgv1.Rows[i].Cells["新报废数量"].Value))
                        {
                            objOriginalValue = tp4_dgv1.Rows[i].Cells["原报废数量"].Value;
                            objNewValue = tp4_dgv1.Rows[i].Cells["新报废数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz010")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的报废数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //接收确认数量
                        if (!tp4_dgv1.Rows[i].Cells["原接收确认数量"].Value.Equals(tp4_dgv1.Rows[i].Cells["新接收确认数量"].Value))
                        {
                            objOriginalValue = tp4_dgv1.Rows[i].Cells["原接收确认数量"].Value;
                            objNewValue = tp4_dgv1.Rows[i].Cells["新接收确认数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz022")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的接收确认数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //转出数量
                        if (!tp4_dgv1.Rows[i].Cells["原转出数量"].Value.Equals(tp4_dgv1.Rows[i].Cells["新转出数量"].Value))
                        {
                            objOriginalValue = tp4_dgv1.Rows[i].Cells["原转出数量"].Value;
                            objNewValue = tp4_dgv1.Rows[i].Cells["新转出数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz030")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的转出数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //扣上工序数量
                        if (!tp4_dgv1.Rows[i].Cells["原扣上工序数量"].Value.Equals(tp4_dgv1.Rows[i].Cells["新扣上工序数量"].Value))
                        {
                            objOriginalValue = tp4_dgv1.Rows[i].Cells["原扣上工序数量"].Value;
                            objNewValue = tp4_dgv1.Rows[i].Cells["新扣上工序数量"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz033")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的扣上工序数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                    }
                    tsslResult.Text = "修改工单号" + strTmpGDNo + "的工序移转数量完成！";
                }
            }
        }

        private void tp4_btnModify2_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp4_dgv2.Rows.Count > 0)
                {
                    tp4_dgv2.EndEdit();
                    for (int i = 0; i < tp4_dgv2.Rows.Count; i++)
                    {
                        string strTmpID = GeneralTools.GetString(tp4_dgv2.Rows[i].Cells["序号"].Value, string.Empty);
                        object objOriginalValue;
                        object objNewValue;
                        //移转日期
                        if (!tp4_dgv2.Rows[i].Cells["原移转日期"].Value.Equals(tp4_dgv2.Rows[i].Cells["新移转日期"].Value))
                        {
                            object objOriginalID = tp4_dgv2.Rows[i].Cells["移转单号"].Value;
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原移转日期"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新移转日期"].Value;
                            //更改移转日期的同时变更移转单号
                            string strMaxGxyzID = GeneralTools.GetString(sqt.DoCmdScalarData(tp4_strSelectMaxGxyzID.Replace("@Date",GeneralTools .GetString(tp4_dgv2.Rows[i].Cells["新移转日期"].Value,string.Empty ))),string.Empty );
                            if (strMaxGxyzID == "")
                            {
                                strMaxGxyzID =GeneralTools .GetString(tp4_dgv2.Rows[i].Cells["新移转日期"].Value,string .Empty ) + "0000";
                            }
                            string strNewGxyzID =GeneralTools .GetString(Convert.ToDouble(strMaxGxyzID) + 1,string.Empty );
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz011")
                                                                                                            .Replace("@值", strNewGxyzID)
                                                                                                            .Replace("@序号", strTmpID));
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz012")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的移转日期由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty)+";原移转单号"+GeneralTools .GetString (objOriginalID ,string.Empty )+"同时变更为"+strNewGxyzID );
                        }
                        //转出工序
                        if (!tp4_dgv2.Rows[i].Cells["原转出工序"].Value.Equals(tp4_dgv2.Rows[i].Cells["新转出工序"].Value))
                        {
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原转出工序"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新转出工序"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz007")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的转出工序由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //转入工序
                        if (!tp4_dgv2.Rows[i].Cells["原转入工序"].Value.Equals(tp4_dgv2.Rows[i].Cells["新转入工序"].Value))
                        {
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原转入工序"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新转入工序"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz008")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的转入工序由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //接收确认人
                        if (!tp4_dgv2.Rows[i].Cells["原接收确认人"].Value.Equals(tp4_dgv2.Rows[i].Cells["新接收确认人"].Value))
                        {
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原接收确认人"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新接收确认人"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz025")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的接收确认人由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //接收确认时间
                        if (!tp4_dgv2.Rows[i].Cells["原接收确认时间"].Value.Equals(tp4_dgv2.Rows[i].Cells["新接收确认时间"].Value))
                        {
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原接收确认时间"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新接收确认时间"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz026")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的接收确认时间由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                        //备注
                        if (!tp4_dgv2.Rows[i].Cells["原备注"].Value.Equals(tp4_dgv2.Rows[i].Cells["新备注"].Value))
                        {
                            objOriginalValue = tp4_dgv2.Rows[i].Cells["原备注"].Value;
                            objNewValue = tp4_dgv2.Rows[i].Cells["新备注"].Value;
                            sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz029")
                                                                                                            .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                            .Replace("@序号", strTmpID));
                            SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的备注由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        }
                    }
                    tsslResult.Text = "修改工单号" + strTmpGDNo + "的工序移转信息完成！";
                }
            }
        }

        private void tp4_btnJYZT_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp4_dgv2.CurrentRow != null)
                {
                    string strTmpID = GeneralTools.GetString(tp4_dgv2.CurrentRow.Cells["序号"].Value, string.Empty);
                    bool bTested = false;
                    if (tp4_dgv2.CurrentRow.Cells["已检验"].Value.Equals("Y") &&
                    tp4_dgv2.CurrentRow.Cells["检验结论"].Value.Equals("合格"))
                    {
                        bTested = true;
                    }
                    if (bTested)
                    {
                        //已检验改为未检验
                        sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz023")
                                                                                                        .Replace("@值", "")
                                                                                                        .Replace("@序号", strTmpID));
                        sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz034")
                                                                                                        .Replace("@值", "")
                                                                                                        .Replace("@序号", strTmpID));
                        SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的检验状态由已检验修改为未检验");
                        for (int i = 0; i < tp4_dgv2.Columns.Count; i++)
                        {
                            if (tp4_dgv2.Columns[i].Name.Contains("新"))
                            {
                                tp4_dgv2.CurrentRow.Cells[i].Style.BackColor = Color.Yellow;
                            }
                            else
                            {
                                tp4_dgv2.CurrentRow.Cells[i].Style.BackColor = Color.LightGray;
                            }
                        }
                        tp4_dgv2.CurrentRow.Cells["已检验"].Value = string.Empty;
                        tp4_dgv2.CurrentRow.Cells["检验结论"].Value = string.Empty;
                    }
                    else
                    {
                        //未检验改为已检验
                        sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz023")
                                                                                                        .Replace("@值", "Y")
                                                                                                        .Replace("@序号", strTmpID));
                        sqt.DoCmdExecuteNonQuery(tp4_strUpdateGxyz.Replace("@字段", "gxyz034")
                                                                                                        .Replace("@值", "合格")
                                                                                                        .Replace("@序号", strTmpID));
                        SQLLogHelper.WriteLog("工序移转序号" + strTmpID + "的检验状态由未检验修改为已检验");
                        for (int i = 0; i < tp4_dgv2.Columns.Count; i++)
                        {
                            if (tp4_dgv2.Columns[i].Name.Contains("新"))
                            {
                                tp4_dgv2.CurrentRow.Cells[i].Style.BackColor = Color.Yellow;
                            }
                            else
                            {
                                tp4_dgv2.CurrentRow.Cells[i].Style.BackColor = Color.White ;
                            }
                        }
                        tp4_dgv2.CurrentRow.Cells["已检验"].Value = "Y";
                        tp4_dgv2.CurrentRow.Cells["检验结论"].Value = "合格";
                    }
                    tsslResult.Text = "修改工单号" + strTmpGDNo + "的移转单检验状态完成！";
                }
            }
        }

        private void tp6_dgv1_CurrentCellChanged(object sender, EventArgs e)
        {
            if (tp6_dgv1.CurrentRow != null)
            {
                tp6_txtRkID.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["入库单号"].Value, string.Empty);
                tp6_txtRkDate.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["入库日期"].Value, string.Empty);
                tp6_txtRksl.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["入库数量"].Value, string.Empty);
                tp6_txtSjrksl.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["实际入库数量"].Value, string.Empty);
                tp6_txtHjh.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["货架号"].Value, string.Empty);
                tp6_txtScrq.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["生产日期"].Value, string.Empty);
                tp6_txtTtl.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["淘汰率"].Value, string.Empty);
                tp6_txtSxsl.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["筛选数量"].Value, string.Empty);
                tp6_txtHd.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["产品厚度"].Value, string.Empty);
                tp6_txtBz.Text = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["备注"].Value, string.Empty);
            }
        }

        private void tp6_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp6_dgv1.CurrentRow !=null )
                {
                    string strTmpID = GeneralTools.GetString(tp6_dgv1.CurrentRow.Cells["入库单号"].Value, string.Empty);
                    object objOriginalValue;
                    object objNewValue;
                    //入库日期
                    if (!tp6_txtRkDate.Text.Equals(tp6_dgv1.CurrentRow.Cells["入库日期"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["入库日期"].Value;
                        objNewValue = tp6_txtRkDate.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk002")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的入库入库日期由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["入库日期"].Value = objNewValue;
                    }
                    //入库数量
                    if (!tp6_txtRksl .Text.Equals (tp6_dgv1.CurrentRow.Cells["入库数量"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["入库数量"].Value;
                        objNewValue = tp6_txtRksl.Text.Trim ();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk .Replace("@字段", "rk018")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的入库数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["入库数量"].Value = objNewValue;
                    }
                    //实际入库数量
                    if (!tp6_txtSjrksl.Text.Equals(tp6_dgv1.CurrentRow.Cells["实际入库数量"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["实际入库数量"].Value;
                        objNewValue = tp6_txtSjrksl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk033")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        sqt.DoCmdExecuteNonQuery(strUpdateGxjyChanged.Replace("@GDNo", strTmpGDNo));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的实际入库数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty)+"，成品库工序结余已同步更新。");
                        tp6_dgv1.CurrentRow.Cells["实际入库数量"].Value = objNewValue;
                    }
                    //货架号
                    if (!tp6_txtHjh.Text.Equals(tp6_dgv1.CurrentRow.Cells["货架号"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["货架号"].Value;
                        objNewValue = tp6_txtHjh.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk027")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的货架号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["货架号"].Value = objNewValue;
                    }
                    //产品厚度
                    if (!tp6_txtHd.Text.Equals(tp6_dgv1.CurrentRow.Cells["产品厚度"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["产品厚度"].Value;
                        objNewValue = tp6_txtHd.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk036")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的产品厚度由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["产品厚度"].Value = objNewValue;
                    }
                    //生产日期
                    if (!tp6_txtScrq.Text.Equals(tp6_dgv1.CurrentRow.Cells["生产日期"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["生产日期"].Value;
                        objNewValue = tp6_txtScrq.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk028")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的生产日期由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["生产日期"].Value = objNewValue;
                    }
                    //淘汰率
                    if (!tp6_txtTtl.Text.Equals(tp6_dgv1.CurrentRow.Cells["淘汰率"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["淘汰率"].Value;
                        objNewValue = tp6_txtTtl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk029")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的淘汰率由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["淘汰率"].Value = objNewValue;
                    }
                    //筛选数量
                    if (!tp6_txtSxsl.Text.Equals(tp6_dgv1.CurrentRow.Cells["淘汰率"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["筛选数量"].Value;
                        objNewValue = tp6_txtSxsl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk030")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的筛选数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["筛选数量"].Value = objNewValue;
                    }
                    //备注
                    if (!tp6_txtBz.Text.Equals(tp6_dgv1.CurrentRow.Cells["备注"].Value))
                    {
                        objOriginalValue = tp6_dgv1.CurrentRow.Cells["备注"].Value;
                        objNewValue = tp6_txtBz.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxrk.Replace("@字段", "rk019")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@入库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序入库单" + strTmpID + "的备注由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp6_dgv1.CurrentRow.Cells["备注"].Value = objNewValue;
                    }
                    sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxjyFromGxrk.Replace("@入库单号", strTmpID));
                    sqt.DoCmdExecuteNonQuery(tp6_strUpdateGxckFromGxrk.Replace("@入库单号", strTmpID));
                    tsslResult.Text = "入库单" + strTmpID + "的入库信息修改完成！工序结余信息及工序出库信息已同步修改！";
                }
            }
        }

        private void tp7_dgv1_CurrentCellChanged(object sender, EventArgs e)
        {
            if (tp7_dgv1.CurrentRow != null)
            {
                tp7_txtCkID.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["出库单号"].Value, string.Empty);
                tp7_txtXhgg.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["型号规格"].Value, string.Empty);
                tp7_txtCpmc.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["产品名称"].Value, string.Empty);
                tp7_txtLzkh.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["流转卡号"].Value, string.Empty);
                tp7_txtCksl.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["出库数量"].Value, string.Empty);
                tp7_txtSysl.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["试验数量"].Value, string.Empty);
                tp7_txtScrq.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["生产日期"].Value, string.Empty);
                tp7_txtHjh.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["货架号"].Value, string.Empty);
                tp7_txtTtl.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["淘汰率"].Value, string.Empty);
                tp7_txtSxsl.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["筛选数量"].Value, string.Empty);
                tp7_txtZjckkh.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["自检出库卡号"].Value, string.Empty);
                tp7_txtBz.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["备注"].Value, string.Empty);
                tp7_txtHd.Text = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["产品厚度"].Value, string.Empty);
            }
        }

        private void tp7_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                if (tp7_dgv1.CurrentRow != null)
                {
                    string strTmpID = GeneralTools.GetString(tp7_dgv1.CurrentRow.Cells["出库单号"].Value, string.Empty);
                    object objOriginalValue;
                    object objNewValue;
                    //型号规格
                    if (!tp7_txtXhgg.Text.Equals(tp7_dgv1.CurrentRow.Cells["型号规格"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["型号规格"].Value;
                        objNewValue = tp7_txtXhgg.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck012")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的型号规格由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["型号规格"].Value = objNewValue;
                    }
                    //产品名称
                    if (!tp7_txtCpmc.Text.Equals(tp7_dgv1.CurrentRow.Cells["产品名称"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["产品名称"].Value;
                        objNewValue = tp7_txtCpmc.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck013")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的产品名称由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["产品名称"].Value = objNewValue;
                    }
                    //流转卡号
                    if (!tp7_txtLzkh.Text.Equals(tp7_dgv1.CurrentRow.Cells["流转卡号"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["流转卡号"].Value;
                        objNewValue = tp7_txtLzkh.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck017")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的流转卡号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["流转卡号"].Value = objNewValue;
                    }
                    //出库数量
                    if (!tp7_txtCksl.Text.Equals(tp7_dgv1.CurrentRow.Cells["出库数量"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["出库数量"].Value;
                        objNewValue = tp7_txtCksl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck015")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        sqt.DoCmdExecuteNonQuery(strUpdateGxjyChanged.Replace("@GDNo", strTmpGDNo));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的出库数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty)+"，成品库工序结余已一并更新。");
                        tp7_dgv1.CurrentRow.Cells["出库数量"].Value = objNewValue;
                    }
                    //生产日期
                    if (!tp7_txtScrq.Text.Equals(tp7_dgv1.CurrentRow.Cells["生产日期"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["生产日期"].Value;
                        objNewValue = tp7_txtScrq.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck021")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的生产日期由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["生产日期"].Value = objNewValue;
                    }
                    //货架号
                    if (!tp7_txtHjh.Text.Equals(tp7_dgv1.CurrentRow.Cells["货架号"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["货架号"].Value;
                        objNewValue = tp7_txtHjh.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck020")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的货架号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["货架号"].Value = objNewValue;
                    }
                    //淘汰率
                    if (!tp7_txtTtl.Text.Equals(tp7_dgv1.CurrentRow.Cells["淘汰率"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["淘汰率"].Value;
                        objNewValue = tp7_txtTtl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck022")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的淘汰率由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["淘汰率"].Value = objNewValue;
                    }
                    //筛选数量
                    if (!tp7_txtSxsl.Text.Equals(tp7_dgv1.CurrentRow.Cells["筛选数量"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["筛选数量"].Value;
                        objNewValue = tp7_txtSxsl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck023")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的筛选数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["筛选数量"].Value = objNewValue;
                    }
                    //试验数量
                    if (!tp7_txtSysl.Text.Equals(tp7_dgv1.CurrentRow.Cells["试验数量"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["试验数量"].Value;
                        objNewValue = tp7_txtSysl.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck037")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        sqt.DoCmdExecuteNonQuery(strUpdateGxjyChanged.Replace("@GDNo", strTmpGDNo));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的试验数量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty)+"，成品库工序结余已一并更新。");
                        tp7_dgv1.CurrentRow.Cells["试验数量"].Value = objNewValue;
                    }
                    //自检出库卡号
                    if (!tp7_txtZjckkh.Text.Equals(tp7_dgv1.CurrentRow.Cells["自检出库卡号"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["自检出库卡号"].Value;
                        objNewValue = tp7_txtZjckkh.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck039")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的自检出库卡号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["自检出库卡号"].Value = objNewValue;
                    }
                    //备注
                    if (!tp7_txtBz.Text.Equals(tp7_dgv1.CurrentRow.Cells["备注"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["备注"].Value;
                        objNewValue = tp7_txtBz.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck024")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的备注由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["备注"].Value = objNewValue;
                    }
                    //厚度
                    if (!tp7_txtHd.Text.Equals(tp7_dgv1.CurrentRow.Cells["产品厚度"].Value))
                    {
                        objOriginalValue = tp7_dgv1.CurrentRow.Cells["产品厚度"].Value;
                        objNewValue = tp7_txtHd.Text.Trim();
                        sqt.DoCmdExecuteNonQuery(tp7_strUpdateGxck.Replace("@字段", "gxck055")
                                                                                                        .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                        .Replace("@出库单号", strTmpID));
                        SQLLogHelper.WriteLog("工序出库单" + strTmpID + "的产品厚度由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                        tp7_dgv1.CurrentRow.Cells["产品厚度"].Value = objNewValue;
                    }
                    tsslResult.Text = "出库单" + strTmpID + "的出库信息修改完成！";
                }
            }
        }

        private void tp8_btnQuery_Click(object sender, EventArgs e)
        {
            if (dgv1 .CurrentRow !=null )
            {
                if (!tp8_txtNewResourceSN.Text.Trim ().Equals(string.Empty))
                {
                    string strTmpGxName = string.Empty;
                    switch (GeneralTools.GetString(dgv1.CurrentRow.Cells["工单类型"].Value, string.Empty))
                    {
                        case "A":
                            return;
                            break;
                        case "B":
                            strTmpGxName = "半成品库";
                            break;
                        case "C":
                            strTmpGxName = "在制品库";
                            break;
                        default :
                            return;
                            break;
                    }
                    DataTable tmpdt = sqt.GetData(tp8_strSelectKcFromSN.Replace("@批号", tp8_txtNewResourceSN.Text.Trim())
                                                                                                                .Replace("@工序名称", strTmpGxName));
                    tp8_dgv1.DataSource = tmpdt;
                    tp8_dgv1.AutoResizeColumns();
                }
            }
        }

        private void tp8_dgv1_CurrentCellChanged(object sender, EventArgs e)
        {
            if (tp8_dgv1.CurrentRow != null)
            {
                tp8_txtNewResourceGDNo.Text = GeneralTools.GetString(tp8_dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
            }
            else
            {
                tp8_txtNewResourceGDNo.Clear();
            }
        }

        private void tp8_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                object objOriginalValue = tp8_txtOldResourceGDNo.Text.Trim();
                object objNewValue = tp8_txtNewResourceGDNo.Text.Trim();
                if (tp8_chkSyncQuantity.Checked&&(!objNewValue.Equals (string.Empty )))
                {
                    int iCount_Kksl = 0;
                    iCount_Kksl =GeneralTools .GetInt(dgv1.CurrentRow .Cells ["开卡数量"].Value ,0);
                    string strTmpGxName = string.Empty;
                    switch (GeneralTools.GetString(dgv1.CurrentRow.Cells["工单类型"].Value, string.Empty))
                    {
                        case "A":
                            return;
                            break;
                        case "B":
                            strTmpGxName = "半成品库";
                            break;
                        case "C":
                            strTmpGxName = "在制品库";
                            break;
                        default:
                            return;
                            break;
                    }
                    int iCount_Gxjy = GeneralTools.GetInt(sqt.DoCmdScalarData(tp8_strSelectKcFromGdno.Replace("@GDNo", GeneralTools .GetString (objNewValue ,string.Empty ))
                                                                                                                                                                    .Replace("@工序名称", strTmpGxName)), 0);
                    if (iCount_Gxjy < iCount_Kksl)
                    {
                        GeneralTools.ShowInfoMsg("新芯片无足够库存!");
                        return;
                    }
                    sqt.DoCmdExecuteNonQuery(tp8_strUpdateGxjy.Replace("@字段", "gxjy008")
                                                                                                    .Replace("@值", "gxjy008-" + iCount_Kksl)
                                                                                                    .Replace("@GDNo", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@工序名称", strTmpGxName));
                    sqt.DoCmdExecuteNonQuery(tp8_strUpdateGxjy.Replace("@字段", "gxjy008")
                                                                                                    .Replace("@值", "gxjy008+" + iCount_Kksl)
                                                                                                    .Replace("@GDNo", GeneralTools.GetString(objOriginalValue, string.Empty))
                                                                                                    .Replace("@工序名称", strTmpGxName));
                }
                sqt.DoCmdExecuteNonQuery(tp8_strUpdateResourceGD.Replace("@GDNo", strTmpGDNo)
                                                                                                            .Replace("@来源工单", GeneralTools.GetString(objNewValue, string.Empty)));
                if (tp8_chkSyncQuantity.Checked)
                {
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的来源工单由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty)+";来源工单的数量已同步修改！");
                }
                else
                {
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的来源工单由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                }
            }
        }

        private void tp9_btnModify_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow != null && (!GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty).Equals(string.Empty)))
            {
                string strTmpGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
                object objOriginalValue;
                object objNewValue;
                //型号
                if (!tp9_txtXh.Text.Equals(tp9_txtXh.Tag))
                {
                    objOriginalValue = tp9_txtXh.Tag;
                    objNewValue = tp9_txtXh.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka002")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的型号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtXh.Tag = objNewValue;
                }
                //尺寸
                if (!tp9_txtCc.Text.Equals(tp9_txtCc.Tag))
                {
                    objOriginalValue = tp9_txtCc.Tag;
                    objNewValue = tp9_txtCc.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka003")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的尺寸由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtCc.Tag = objNewValue;
                }
                //特性
                if (!tp9_txtTx.Text.Equals(tp9_txtTx.Tag))
                {
                    objOriginalValue = tp9_txtTx.Tag;
                    objNewValue = tp9_txtTx.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka004")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的特性由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtTx.Tag = objNewValue;
                }
                //电压
                if (!tp9_txtDy.Text.Equals(tp9_txtDy.Tag))
                {
                    objOriginalValue = tp9_txtDy.Tag;
                    objNewValue = tp9_txtDy.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka005")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的电压由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtDy.Tag = objNewValue;
                }
                //容量
                if (!tp9_txtRl.Text.Equals(tp9_txtRl.Tag))
                {
                    objOriginalValue = tp9_txtRl.Tag;
                    objNewValue = tp9_txtRl.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka006")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的容量由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtRl.Tag = objNewValue;
                }
                //精度
                if (!tp9_txtJd.Text.Equals(tp9_txtJd.Tag))
                {
                    objOriginalValue = tp9_txtJd.Tag;
                    objNewValue = tp9_txtJd.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka007")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的精度由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtJd.Tag = objNewValue;
                }
                //印叠机型
                if (!tp9_txtYdjx.Text.Equals(tp9_txtYdjx.Tag))
                {
                    objOriginalValue = tp9_txtYdjx.Tag;
                    objNewValue = tp9_txtYdjx.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka008")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的印叠机型由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtYdjx.Tag = objNewValue;
                }
                //排粘曲线
                if (!tp9_txtPzqx.Text.Equals(tp9_txtPzqx.Tag))
                {
                    objOriginalValue = tp9_txtPzqx.Tag;
                    objNewValue = tp9_txtPzqx.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka009")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的排粘曲线由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtPzqx.Tag = objNewValue;
                }
                //烧结温度
                if (!tp9_txtSjwd.Text.Equals(tp9_txtSjwd.Tag))
                {
                    objOriginalValue = tp9_txtSjwd.Tag;
                    objNewValue = tp9_txtSjwd.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka010")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的烧结温度由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtSjwd.Tag = objNewValue;
                }
                //瓷膜批号
                if (!tp9_txtCmph.Text.Equals(tp9_txtCmph.Tag))
                {
                    objOriginalValue = tp9_txtCmph.Tag;
                    objNewValue = tp9_txtCmph.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka011")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的瓷膜批号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtCmph.Tag = objNewValue;
                }
                //内浆批号
                if (!tp9_txtNjph.Text.Equals(tp9_txtNjph.Tag))
                {
                    objOriginalValue = tp9_txtNjph.Tag;
                    objNewValue = tp9_txtNjph.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka012")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的内浆批号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtNjph.Tag = objNewValue;
                }
                //端浆批号
                if (!tp9_txtDjph.Text.Equals(tp9_txtDjph.Tag))
                {
                    objOriginalValue = tp9_txtDjph.Tag;
                    objNewValue = tp9_txtDjph.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka013")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的端浆批号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtDjph.Tag = objNewValue;
                }
                //丝网代号
                if (!tp9_txtSwdh.Text.Equals(tp9_txtSwdh.Tag))
                {
                    objOriginalValue = tp9_txtSwdh.Tag;
                    objNewValue = tp9_txtSwdh.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka014")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的丝网代号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtSwdh.Tag = objNewValue;
                }
                //印叠层数
                if (!tp9_txtYdcs.Text.Equals(tp9_txtYdcs.Tag))
                {
                    objOriginalValue = tp9_txtYdcs.Tag;
                    objNewValue = tp9_txtYdcs.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka015")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的印叠层数由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtYdcs.Tag = objNewValue;
                }
                //瓷料名称
                if (!tp9_txtClmc.Text.Equals(tp9_txtClmc.Tag))
                {
                    objOriginalValue = tp9_txtClmc.Tag;
                    objNewValue = tp9_txtClmc.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka016")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的瓷料名称由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtClmc.Tag = objNewValue;
                }
                //钵号
                if (!tp9_txtBh.Text.Equals(tp9_txtBh.Tag))
                {
                    objOriginalValue = tp9_txtBh.Tag;
                    objNewValue = tp9_txtBh.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka017")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的钵号由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtBh.Tag = objNewValue;
                }
                //质量等级
                if (!tp9_txtZldj.Text.Equals(tp9_txtZldj.Tag))
                {
                    objOriginalValue = tp9_txtZldj.Tag;
                    objNewValue = tp9_txtZldj.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka018")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的质量等级由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtZldj.Tag = objNewValue;
                }
                //膜厚
                if (!tp9_txtMh.Text.Equals(tp9_txtMh.Tag))
                {
                    objOriginalValue = tp9_txtMh.Tag;
                    objNewValue = tp9_txtMh.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka019")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的膜厚由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtMh.Tag = objNewValue;
                }
                //芯片尺寸
                if (!tp9_txtXpcc.Text.Equals(tp9_txtXpcc.Tag))
                {
                    objOriginalValue = tp9_txtXpcc.Tag;
                    objNewValue = tp9_txtXpcc.Text.Trim();
                    sqt.DoCmdExecuteNonQuery(tp9_strUpdatePraka.Replace("@字段", "aka020")
                                                                                                    .Replace("@值", GeneralTools.GetString(objNewValue, string.Empty))
                                                                                                    .Replace("@GDNo", strTmpGDNo));
                    SQLLogHelper.WriteLog("工单" + strTmpGDNo + "的工程设计参数中的芯片尺寸由" + GeneralTools.GetString(objOriginalValue, string.Empty) + "修改为" + GeneralTools.GetString(objNewValue, string.Empty));
                    tp9_txtXpcc.Tag = objNewValue;
                }
                tsslResult.Text = "工单" + strTmpGDNo  + "的工程设计参数修改完成！";
            }
        }

        /// <summary>
        /// 查询工单数据
        /// </summary>
        /// <param name="QueryMode">查询模式：1：批号；2：工单号；3：型号规格</param>
        private void Query(int QueryMode)
        {
            string strTmpSelectString = strDefaultSelectString;
            string strTmpKey = string.Empty;
            if (txtSN.Text.Trim().Equals(string.Empty) && txtGDNo.Text.Trim().Equals(string.Empty) && txtModel.Text.Trim().Equals(string.Empty))
            {
                txtSN.Focus();
                return;
            }
            //查询条件分先后顺序，批号>工单号>型号规格
            if ((!txtModel.Text.Trim().Equals(string.Empty)) && (QueryMode == 3 || QueryMode == 4))
            {
                strTmpKey = "gd007 like '" + txtModel.Text.Trim() + "'";
            }
            if ((!txtGDNo.Text.Trim().Equals(string.Empty)) && (QueryMode == 2 || QueryMode == 4))
            {
                strTmpKey = "gd001='" + txtGDNo.Text.Trim() + "'";
            }
            if ((!txtSN.Text.Trim().Equals(string.Empty)) && (QueryMode == 1 || QueryMode == 4))
            {
                strTmpKey = "gd034 like '" + txtSN.Text.Trim() + "'";
            }
            if (strTmpSelectString.Contains(" where "))
            {
                strTmpSelectString += " and ";
            }
            else
            {
                strTmpSelectString += " where ";
            }
            strTmpSelectString += strTmpKey;
            dgv1.DataSource = sqt.GetData(strTmpSelectString);
            dgv1.AutoResizeColumns();
            if (dgv1.Rows.Count > 0)
            {
                dgv1.CurrentCell = dgv1.Rows[0].Cells[0];
                for (int i = 0; i < dgv1.Rows.Count; i++)
                {
                    if (GeneralTools.GetString(dgv1.Rows[i].Cells["已审核"].Value, string.Empty).Equals(string.Empty))
                    {
                        dgv1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    }
                }
            }
        }

        /// <summary>
        /// 清理
        /// </summary>
        private void Clear()
        {
            for (int i = 0; i < tabControl1.TabPages.Count; i++)
            {
                foreach (Control c in tabControl1.TabPages[i].Controls)
                {
                    switch (c.GetType().Name )
                    {
                        case "TextBox":
                            ((TextBox)c).Clear();
                            break;
                        case "ListBox":
                            ((ListBox)c).Items.Clear();
                            break;
                    }
                }
            }
        }

        private void iniTP1(string strGDNo)
        {
            //清除原有数据
            tp1_txtModelOld.Clear();
            tp1_txtModelNew.Clear();
            tp1_txtProductNameOld.Clear();
            tp1_txtProductNameNew.Clear();
            tp1_txtKkrqOld.Clear();
            tp1_txtKkrqNew.Clear();
            tp1_txtSNOld.Clear();
            tp1_txtSNNew.Clear();
            tp1_txtQuantityOld.Clear();
            tp1_txtQuantityNew.Clear();
            tp1_txtMemoOld.Clear();
            tp1_txtMemoNew.Clear();
            tp1_txtZldjOld.Clear();
            tp1_txtZldjNew.Clear();
            //填充数据
            DataTable tmpdt = sqt.GetData(tp1_strSelectGDInfo.Replace("@GDNo", strGDNo));
            if (tmpdt.Rows.Count > 0)
            {
                tp1_txtModelOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["型号规格"], string.Empty);
                tp1_txtModelNew.Text = tp1_txtModelOld.Text;
                tp1_txtProductNameOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["产品名称"], string.Empty);
                tp1_txtProductNameNew.Text = tp1_txtProductNameOld.Text;
                tp1_txtKkrqOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["开卡日期"], string.Empty);
                tp1_txtKkrqNew.Text = tp1_txtKkrqOld.Text;
                tp1_txtSNOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["批号"], string.Empty);
                tp1_txtSNNew.Text = tp1_txtSNOld.Text;
                tp1_txtQuantityOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["开卡数量"], string.Empty);
                tp1_txtQuantityNew.Text = tp1_txtQuantityOld.Text;
                tp1_txtMemoOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["备注"], string.Empty);
                tp1_txtMemoNew.Text = tp1_txtMemoOld.Text;
                tp1_txtZxbzOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["执行标准"], string.Empty);
                tp1_txtZxbzNew.Text = tp1_txtZxbzOld.Text;
                tp1_txtZldjOld.Text = GeneralTools.GetString(tmpdt.Rows[0]["质量等级"], string.Empty);
                tp1_txtZldjNew.Text = tp1_txtZldjOld.Text;
            }
        }

        private void iniTP2(string strGDNo,string strGDType)
        {
            //设置按钮状态
            switch (strGDType)
            {
                case "A":
                    tp2_btnA.Enabled = true;
                    tp2_btnB_ps.Enabled = false;
                    tp2_btnByx.Enabled = false;
                    tp2_btnC.Enabled = false;
                    break;
                case "B":
                    tp2_btnA.Enabled = false ;
                    tp2_btnB_ps.Enabled = true ;
                    tp2_btnByx.Enabled = true;
                    tp2_btnC.Enabled = false;
                    break;
                case "C":
                    tp2_btnA.Enabled = false ;
                    tp2_btnB_ps.Enabled = false;
                    tp2_btnByx.Enabled = false;
                    tp2_btnC.Enabled = true ;
                    break;
                default :
                    tp2_btnA.Enabled = true;
                    tp2_btnB_ps.Enabled = true;
                    tp2_btnByx.Enabled = true;
                    tp2_btnC.Enabled = true;
                    break;
            }
            //清除原有数据
            tp2_lstGXOld.Items.Clear();
            tp2_lstGXNew.Items.Clear();
            //填充数据
            sqt.FillListBox(tp2_lstGXOld, tp2_strSelectGdgx.Replace("@GDNo", strGDNo));
        }

        private void iniTP3(string strGDNo)
        {
            //填充数据
            DataTable tmpdt = sqt.GetData(tp3_strSelectGxjy.Replace("@GDNo", strGDNo));
            tp3_dgv1.DataSource = tmpdt;
            tp3_dgv1.AutoResizeColumns();
            //设置格式
            tp3_dgv1.ReadOnly = false;
            for (int i = 0; i < tp3_dgv1.Columns.Count; i++)
            {
                if (tp3_dgv1.Columns[i].Name.StartsWith("新"))
                {
                    tp3_dgv1.Columns[i].ReadOnly = false;
                    tp3_dgv1.Columns[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
                else
                {
                    tp3_dgv1.Columns[i].ReadOnly = true;
                }
            }
        }

        private void iniTP4(string strGDNo)
        {
            //填充数据
            DataTable tmpdt1 = sqt.GetData(tp4_strSelectGxyz_Quantity.Replace("@GDNo", strGDNo));
            tp4_dgv1.DataSource = tmpdt1;
            tp4_dgv1.AutoResizeColumns();
            DataTable tmpdt2 = sqt.GetData(tp4_strSelectGxyz_OtherInfo.Replace("@GDNo", strGDNo));
            tp4_dgv2.DataSource = tmpdt2;
            tp4_dgv2.AutoResizeColumns();
            //设置格式
            tp4_dgv1.ReadOnly = false;
            for (int i = 0; i < tp4_dgv1.Columns.Count; i++)
            {
                if (tp4_dgv1.Columns[i].Name.StartsWith("新"))
                {
                    tp4_dgv1.Columns[i].ReadOnly = false;
                    tp4_dgv1.Columns[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
                else
                {
                    tp4_dgv1.Columns[i].ReadOnly = true;
                }
            }
            tp4_dgv2.ReadOnly = false;
            for (int i = 0; i < tp4_dgv2.Columns.Count; i++)
            {
                if (tp4_dgv2.Columns[i].Name.StartsWith("新"))
                {
                    tp4_dgv2.Columns[i].ReadOnly = false;
                    tp4_dgv2.Columns[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
                else
                {
                    tp4_dgv2.Columns[i].ReadOnly = true;
                }
            }
            for (int i = 0; i < tp4_dgv2.Rows.Count; i++)
            {
                if ((!tp4_dgv2.Rows[i].Cells["已检验"].Value.Equals("Y")) ||
                    (!tp4_dgv2.Rows[i].Cells["检验结论"].Value.Equals("合格")))
                {
                    //检验未合格的移转单为灰色
                    tp4_dgv2.Rows[i].DefaultCellStyle.BackColor = Color.LightGray ;
                }
            }
        }

        private void iniTP6(string strGDNo)
        {
            //填充数据
            DataTable tmpdt = sqt.GetData(tp6_strSelectGxrk.Replace("@GDNo", strGDNo));
            tp6_dgv1.DataSource = tmpdt;
            tp6_dgv1.AutoResizeColumns();
            //设置格式
            tp6_dgv1.ReadOnly = true;
        }

        private void iniTP7(string strGDNo)
        {
            //填充数据
            DataTable tmpdt = sqt.GetData(tp7_strSelectGxck.Replace("@GDNo", strGDNo));
            tp7_dgv1.DataSource = tmpdt;
            tp7_dgv1.AutoResizeColumns();
            //设置格式
            tp7_dgv1.ReadOnly = true;
            //计算总项数和总数量
            tp7_txtCkzxs.Text = tp7_dgv1.Rows.Count.ToString();
            int iCount = 0;
            for (int i = 0; i < tp7_dgv1.Rows.Count; i++)
            {
                iCount += GeneralTools.GetInt(tp7_dgv1.Rows[i].Cells["出库数量"].Value, 0) - GeneralTools.GetInt(tp7_dgv1.Rows[i].Cells["出库退回数量"].Value, 0) + GeneralTools.GetInt(tp7_dgv1.Rows[i].Cells["试验数量"].Value, 0);
            }
            tp7_txtCkzsl.Text = iCount.ToString();
        }

        private void iniTP8(string strGDNo, string strGDType)
        {
            //清除界面
            tp8_txtNewResourceGDNo.Clear();
            tp8_txtNewResourceSN.Clear();
            tp8_dgv1.DataSource = null;
            //填充数据
            tp8_txtOldResourceGDNo.Text = GeneralTools.GetString(dgv1.CurrentRow.Cells["来源工单"].Value, string.Empty);
            if (!tp8_txtOldResourceGDNo.Text.Equals(string.Empty))
            {
                tp8_txtOldResourceSN.Text = GeneralTools.GetString(sqt.DoCmdScalarData(tp8_strSelectSNFromGdno.Replace("@GDNo", tp8_txtOldResourceGDNo.Text.Trim())),string.Empty);
            }
            else
            {
                tp8_txtOldResourceSN.Clear();
            }
            DataTable tmpdt = sqt.GetData(tp8_strSelectSubGD.Replace("@GDNo", strGDNo));
            tp8_dgv2.DataSource = tmpdt;
            tp8_dgv2.AutoResizeColumns();
            //设置格式
            tp8_dgv1.ReadOnly = true;
            tp8_dgv2.ReadOnly = true;
        }

        private void iniTP9(string strGDNo)
        {
            //清除原有数据
            tp9_txtZldj.Tag = null;
            tp9_txtXh.Tag = null;
            tp9_txtCc.Tag = null;
            tp9_txtTx.Tag = null;
            tp9_txtDy.Tag = null;
            tp9_txtRl.Tag = null;
            tp9_txtJd.Tag = null;
            tp9_txtYdjx.Tag = null;
            tp9_txtSjwd.Tag = null;
            tp9_txtNjph.Tag = null;
            tp9_txtSwdh.Tag = null;
            tp9_txtClmc.Tag = null;
            tp9_txtMh.Tag = null;
            tp9_txtXpcc.Tag = null;
            tp9_txtPzqx.Tag = null;
            tp9_txtCmph.Tag = null;
            tp9_txtDjph.Tag = null;
            tp9_txtYdcs.Tag = null;
            tp9_txtBh.Tag = null;
            //填充数据
            DataTable tmpdt = sqt.GetData (tp9_strSelectPraka .Replace("@GDNo",strGDNo ));
            if (tmpdt.Rows.Count > 0)
            {
                tp9_txtZldj.Tag = tmpdt.Rows[0]["质量等级"];
                tp9_txtXh.Tag = tmpdt.Rows[0]["型号"];
                tp9_txtCc.Tag = tmpdt.Rows[0]["尺寸"];
                tp9_txtTx.Tag = tmpdt.Rows[0]["特性"];
                tp9_txtDy.Tag = tmpdt.Rows[0]["电压"];
                tp9_txtRl.Tag = tmpdt.Rows[0]["容量"];
                tp9_txtJd.Tag = tmpdt.Rows[0]["精度"];
                tp9_txtYdjx.Tag = tmpdt.Rows[0]["印叠机型"];
                tp9_txtSjwd.Tag = tmpdt.Rows[0]["烧结温度"];
                tp9_txtNjph.Tag = tmpdt.Rows[0]["内浆批号"];
                tp9_txtSwdh.Tag = tmpdt.Rows[0]["丝网代号"];
                tp9_txtClmc.Tag = tmpdt.Rows[0]["瓷料名称"];
                tp9_txtMh.Tag = tmpdt.Rows[0]["膜厚"];
                tp9_txtXpcc.Tag = tmpdt.Rows[0]["芯片尺寸"];
                tp9_txtPzqx.Tag = tmpdt.Rows[0]["排粘曲线"];
                tp9_txtCmph.Tag = tmpdt.Rows[0]["瓷膜批号"];
                tp9_txtDjph.Tag = tmpdt.Rows[0]["端浆批号"];
                tp9_txtYdcs.Tag = tmpdt.Rows[0]["印叠层数"];
                tp9_txtBh.Tag = tmpdt.Rows[0]["钵号"];
                tp9_txtZldj.Text =GeneralTools .GetString ( tmpdt.Rows[0]["质量等级"],string.Empty );
                tp9_txtXh.Text = GeneralTools .GetString (tmpdt.Rows[0]["型号"],string.Empty );
                tp9_txtCc.Text =GeneralTools .GetString ( tmpdt.Rows[0]["尺寸"],string.Empty );
                tp9_txtTx.Text = GeneralTools .GetString (tmpdt.Rows[0]["特性"],string.Empty );
                tp9_txtDy.Text = GeneralTools .GetString (tmpdt.Rows[0]["电压"],string.Empty );
                tp9_txtRl.Text = GeneralTools .GetString (tmpdt.Rows[0]["容量"],string.Empty );
                tp9_txtJd.Text = GeneralTools .GetString (tmpdt.Rows[0]["精度"],string.Empty );
                tp9_txtYdjx.Text = GeneralTools .GetString (tmpdt.Rows[0]["印叠机型"],string.Empty );
                tp9_txtSjwd.Text = GeneralTools .GetString (tmpdt.Rows[0]["烧结温度"],string.Empty );
                tp9_txtNjph.Text = GeneralTools .GetString (tmpdt.Rows[0]["内浆批号"],string.Empty );
                tp9_txtSwdh.Text =GeneralTools .GetString ( tmpdt.Rows[0]["丝网代号"],string.Empty );
                tp9_txtClmc.Text = GeneralTools .GetString (tmpdt.Rows[0]["瓷料名称"],string.Empty );
                tp9_txtMh.Text =GeneralTools .GetString ( tmpdt.Rows[0]["膜厚"],string.Empty );
                tp9_txtXpcc.Text = GeneralTools .GetString (tmpdt.Rows[0]["芯片尺寸"],string.Empty );
                tp9_txtPzqx.Text =GeneralTools .GetString ( tmpdt.Rows[0]["排粘曲线"],string.Empty );
                tp9_txtCmph.Text =GeneralTools .GetString ( tmpdt.Rows[0]["瓷膜批号"],string.Empty );
                tp9_txtDjph.Text =GeneralTools .GetString ( tmpdt.Rows[0]["端浆批号"],string.Empty );
                tp9_txtYdcs.Text =GeneralTools .GetString ( tmpdt.Rows[0]["印叠层数"],string.Empty );
                tp9_txtBh.Text = GeneralTools.GetString(tmpdt.Rows[0]["钵号"], string.Empty);
            }
        }

        private void iniTP10(string strGDNo)
        {
            //清除原有内容
            foreach (Control c in tp10.Controls)
            {
                if (c.GetType() == typeof(TextBox))
                {
                    ((TextBox)c).Clear();
                }
            }
            //查询
            tp10_txtKksl.Text = GeneralTools.GetString(sqt.DoCmdScalarData(tp10_strSelectKksl.Replace("@GDNo", strGDNo)), string.Empty);
            tp10_txtKkgx.Text = GeneralTools.GetString(sqt.DoCmdScalarData(tp10_strSelectKkgx.Replace("@GDNo", strGDNo)), string.Empty);
            tp10_txtGd.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGd.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtGdgx.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGdgx.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtCfd.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectCfd.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtGxjy.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGxjy.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtGxyz.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGxyz.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtJyjs.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectJyjs.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtPljy.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectPljy.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtGxrk.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGxrk.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtGxck.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectGxck.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtJsqr.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectJsqr.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtJywh.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectJywh.Replace("@GDNo", strGDNo)), 0), string.Empty);
            tp10_txtZgd.Text = GeneralTools.GetString(GeneralTools.GetInt(sqt.DoCmdScalarData(tp10_strSelectSubGd.Replace("@GDNo", strGDNo)), 0), string.Empty);
        }

        private void tp10_btnDelete_Click(object sender, EventArgs e)
        {
            if (dgv1.CurrentRow == null)
            {
                return;
            }
            string strGDNo = GeneralTools.GetString(dgv1.CurrentRow.Cells["工单号"].Value, string.Empty);
            if (GeneralTools.GetInt(tp10_txtZgd.Text, 0) > 0)
            {
                GeneralTools.ShowInfoMsg("请先删除该工单的全部子工单！");
                return;
            }
            if (GeneralTools.GetInt(tp10_txtJsqr.Text, 0) > 0)
            {
                GeneralTools.ShowInfoMsg("请先删除该工单相关的全部出库接收确认单！");
                return;
            }
            if (tp10_txtKkgx.Text.Trim().Equals(string.Empty))
            {
                if (MessageBox.Show("该工单没有标注开卡工序，结余数量可能无法还原，确认继续操作么？", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    return;
                }
            }
            //变更记录数量
            int iUpdateCount = 0;
            int iDeleteCount = 0;
            //更新结余
            string strTmpKksl=tp10_txtKksl.Text ;
            string strTmpKkgx=tp10_txtKkgx .Text ;
            iUpdateCount+=sqt.DoCmdExecuteNonQuery(tp10_strUpdateGxjy.Replace("@GDNo", strGDNo)
                                                                                                                        .Replace("@开卡数量", strTmpKksl)
                                                                                                                        .Replace("@开卡工序", strTmpKkgx));
            //删除记录
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteGdgx.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteCfd.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteGxjy.Replace("@GDNo", strGDNo)
                                                                                                                        .Replace ("@开卡工序",strTmpKkgx ));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteGxyz.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteJyjs.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteQca.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteQcb.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteGxrk.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteGxck.Replace("@GDNo", strGDNo));
            iDeleteCount += sqt.DoCmdExecuteNonQuery(tp10_strDeleteJywh.Replace("@GDNo", strGDNo));
            GeneralTools.ShowInfoMsg("共更新记录" + iUpdateCount.ToString() + "条！删除记录"+iDeleteCount .ToString ()+"条！");
        }


    }
}
